<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>21在Vue中同时使用过渡和动画</title>
    <script src="./vue.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css">
    <style>
        .myTransition-enter,
        .myTransition-leave-to {
            opacity: 0;
        }

        .myTransition-enter-active,
        .myTransition-leave-active {
            transition: opacity 3s;
            ;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- 解决第一次内容显示没有动画的问题，添加appear  和  appear-active-class="animated swing" -->
        <!--  type="transition"  以 transition 的动画时长为准 也就是 3s-->
        <!--给transition 包裹组件添加  :duration="10000"  属性的意思是： 自定义整个动画播放时长为 1s  -->
        <transition :duration="{enter：5000，leave:10000}" name="myTransition" appear
            enter-active-class="animated swing myTransition-enter-active"
            leave-active-class="animated shake myTransition-leave-active" appear-active-class="animated swing">
            <div v-if="show">hello world</div>
        </transition>
        <button @click="show = !show">change</button>
    </div>
    <script>
        var vm = new Vue({
            el: "#app",
            data: {
                show: true
            },
            methods: {

            },
        })
    </script>
</body>

</html>